import { BasicColumn, BasicTable, FormSchema, useRender, useTable } from "@/components/Table";
import { useTranslation } from "react-i18next";
import { depositHistoryPage } from "@/api/MedicalExamination/index";

export default function index() {
	const { t } = useTranslation();
	const searchFormSchema: FormSchema[] = [
		{
			label: t("patientBasic.patient_id"),
			field: "patientId",
			component: "Input"
		},
		{
			label: t("patientBasic.full_name"),
			field: "fullName",
			component: "Input"
		},
		{
			label: t("patientBasic.birthyear"),
			field: "birthday",
			component: "DatePicker"
		},
		{
			label: t("patientBasic.pat_address"),
			field: "address",
			component: "Input"
		},
		{
			label: t("kevin_ui.admission_date"),
			field: "Admission Date",
			component: "Input"
		},
		{
			label: t("kevin_ui.from_date"),
			field: "from_date",
			component: "DatePicker"
		},
		{
			label: t("kevin_ui.to_date"),
			field: "to_date",
			component: "DatePicker"
		},
		{
			label: t("kevin_ui.discharge_department"),
			field: "discharge_department",
			component: "Select"
		},
		{
			label: "By",
			field: "By",
			component: "Input"
		},
		{
			label: "From Object",
			field: "From Object",
			component: "Select"
		},
		{
			label: "To Object",
			field: "To Object",
			component: "Select"
		}
	];
	const columns: BasicColumn[] = [
		{
			title: t("kevin_ui.date"),
			dataIndex: "createdTime",
			render: text => useRender.renderDate(text)
		},
		{
			title: t("kevin_ui.amount"),
			dataIndex: "fee"
		},
		{
			title: t("kevin_ui.old_Patient_type"),
			dataIndex: "oldPatCardno"
		},
		{
			title: t("kevin_ui.new_patient_type"),
			dataIndex: "newPatCardno"
		},
		{
			title: t("kevin_ui.department"),
			dataIndex: "deptName"
		}
	];
	const [registerTable] = useTable({
		// dataSource: [
		// 	{
		// 		date: "2025-01-22",
		// 		amount: 123.01,
		// 		patient_type: "1",
		// 		department: "12313"
		// 	}
		// ],
		api: depositHistoryPage,
		columns: columns,
		formConfig: {
			labelWidth: 120,
			schemas: searchFormSchema,
			showActionButtonGroup: true,
			baseColProps: { span: 6 }
		},
		useSearchForm: true
	});

	return (
		<div className="page51304">
			<div className="page-content">
				<BasicTable register={registerTable}></BasicTable>
			</div>
		</div>
	);
}
